
#include <linux/module.h>
#include <linux/init.h>


static int __init pfn_valid_init(void)
{ 
    unsigned long pfn_start = 0;
    unsigned long pfn_end = 0x10000000000UL >> PAGE_SHIFT;

    int last_valid = pfn_valid(pfn_start);
    unsigned long pfn = 0;
    for (pfn = 1; pfn < pfn_end; pfn++)
    {
        int valid = pfn_valid(pfn);
        if (valid != last_valid)
        {
            printk("0x%lx -- 0x%lx, pfn_valid: %d\n", pfn_start << PAGE_SHIFT, (pfn << PAGE_SHIFT) - 1, last_valid);
            last_valid = valid;
            pfn_start = pfn;
        }
    }
    printk("0x%lx -- 0x%lx, pfn_valid: %d\n", pfn_start << PAGE_SHIFT, (pfn << PAGE_SHIFT) - 1, last_valid);

    return 0;
}


module_init(pfn_valid_init);

static void __exit pfn_valid_exit(void)
{
    return ;
}
module_exit(pfn_valid_exit);

MODULE_LICENSE("GPL");
